package com.hmall.api.client;

import com.hmall.api.dto.ItemDTO;
import com.hmall.api.dto.OrderDetailDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;

/**
 * @Author: Serendipity-li
 * @Date: 2024/7/24 - 17:51
 * @Description: com.heima.api.client
 */
@FeignClient("item-service")
public interface ItemClient {

    /*
     * @description:根据id批量查询商品
     * @author: louis-li
     * @date: 2024/7/25 21:12
     * @param: [ids]
     * @return: java.util.List<com.hmall.api.dto.ItemDTO>
     **/
    @GetMapping("/items")
    List<ItemDTO> queryItemByIds(@RequestParam("ids")Collection<Long> ids);//参数父类引用指向子类对象

    /*
     * @description:批量扣减库存
     * @author: louis-li
     * @date: 2024/7/25 21:12
     * @param: [items]
     * @return: void
     **/
    @PutMapping("/items/stock/deduct")
    void deductStock(@RequestBody List<OrderDetailDTO> items);

}
